home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 86
/
(Vol 86) My Disc.iso
/
Games
/
pet_1112.swf
/
scripts
/
__Packages
/
EZClick2Drag.as
next >
Wrap
Text File
|
2009-04-14
|
2KB
|
62 lines
class EZClick2Drag extends MovieClip
{
static var RELEASE_DELAY = 500;
static var DRAGGING = false;
var dragging = false;
function EZClick2Drag()
{
super();
if(!this._parent.ezClick2Drags)
{
this._parent.ezClick2Drags = new Array();
}
this._parent.ezClick2Drags.push(this);
this.targets = new Array();
this.targetActions = new Array();
this.onPress = this.press;
}
function press()
{
this.onDragStart(this);
EZClick2Drag.DRAGGING = true;
this.dragging = true;
this.swapDepths(this._parent.getNextHighestDepth());
this.startDrag(false);
this.onMouseDown = this.drop;
delete this.onPress;
}
function initMouseUp()
{
if(this.dragging)
{
this.onMouseUp = this.drop;
}
}
function resetOnPress()
{
this.onPress = this.press;
}
function drop()
{
delete this.onMouseDown;
delete this.onMouseUp;
_global.setTimeout(this,"resetOnPress",10);
EZClick2Drag.DRAGGING = false;
this.dragging = false;
this.stopDrag();
var _loc3_ = false;
for(var _loc4_ in this.targets)
{
if(typeof this.targets[_loc4_] == "movieclip" && this.hitTest(this.targets[_loc4_]) || typeof this.targets[_loc4_] == "object" && this.hitTest(this.targets[_loc4_]._x,this.targets[_loc4_]._y,false))
{
this.targetActions._loc4_(this);
_loc3_ = true;
}
}
if(!_loc3_)
{
this.missedTargetsAction(this);
}
}
}